<?php
/**
 * Description of View_Helper_Fedex
 *
 * Proporciona datos correctios para el uso del servicio Fedex
 *
 * @author HabaX
 */

class View_Helper_fedex extends Model3_View_Helper
{
    public function makeCountriesCombo($name='CountryCode')
    {
        $contries = array( /*'US'=>'Estados Unidos','CA' => 'Canada',*/'MX'=>'México');

        $comboRet = '<select name="'.$name.'">';

        foreach($contries as $key => $contrie)
        {
            $comboRet.= '<option value="'.$key.'">'.$contrie.'</option>';
        }

        $comboRet .= '</select>';

        return $comboRet;

    }

    public function makeMexicoStatesCombo($name='StateOrProvinceCode')
    {

        $states = array(
                            'AG'=>'Aguascalientes',
                            'BC' => 'Baja California Norte',
                            'BS' => 'Baja California Sur' ,
                            'CM'=>'Campeche' ,
                            'CS' =>'Chiapas'  ,
                            'CH'=>'Chihuahua' ,
                            'CO'=> 'Coahuila' ,
                            'CL'=> 'Colima',
                            'DF'=> 'Distrito Federal' ,
                            'DG'=> 'Durango' ,
                            'GR'=> 'Guerrero',
                            'HG'=> 'Hidalgo',
                            'JA' =>'Jalisco' ,
                            'MX'=>'Mexico' ,
                            'MI' => 'Michoacán' ,
                            'MO' => 'Morelos',
                            'NA'=>'Nayarit' ,
                            'NL'=>'Nuevo Leon',
                            'OA' => 'Oaxaca',
                            'PU' => 'Puebla',
                            'QT'=>'Queretaro' ,
                            'QR' =>'Quintana Roo',
                            'SL' => 'San Luis Potosi',
                            'SI' => 'Sinaloa',
                            'SO' => 'Sonora',
                            'TM' => 'Tamaulipas' ,
                            'TL' => 'Tlaxcala' ,
                            'VE'=> 'Veracruz' ,
                            'YU' => 'Yucatan' ,
                            'ZA' => 'Zacatecas',
                        );

        $comboRet = '<select name="'.$name.'">';

        foreach($states as $key => $states)
        {
            $comboRet.= '<option value="'.$key.'">'.$states.'</option>';
        }

        $comboRet .= '</select>';

        return $comboRet;
        
    }
    
    
    public function makeServicesTypeCombo($type)
    {

        $services = array(    'NAC' => array(
                                 'FEDEX_EXPRESS_SAVER' => 'Express( 2 a 4 dias habiles)',
                                'STANDARD_OVERNIGHT' => 'Garantia Antes de Noche(1 a 2 dias habiles)'
                                        ),
                            'INAC' => array(
                                'INTERNATIONAL_ECONOMY' => 'internacional Economico(1 a 2 semanas)',
                                'INTERNATIONAL_PRIORITY' => 'Internacional con Prioridad(3 a 6 dias)'
                                        )
                        );

        $typeArray = 'INAC';
        if($type=='NAC')
        {
            $typeArray = 'NAC';
        }

        $allTypeServices = $services[$typeArray];
        $comboRet = '<select name="ServiceType">';

        foreach($allTypeServices as $key => $service)
        {
            $comboRet.= '<option value="'.$key.'">'.$service.'</option>';
        }

        $comboRet .= '</select>';

        return $comboRet;
        
    }

    public function makePackagingTypeCombo()
    {
        $Envelope = array(
                         'FEDEX_ENVELOPE' => 'Embalaje proporcionado por Fedex',
                         'YOUR_PACKAGING' => 'Enbalaje Propio'
                        );


        $comboRet = '<select name="PackagingType">';

        foreach($Envelope as $key => $packaging)
        {
            $comboRet.= '<option value="'.$key.'">'.$packaging.'</option>';
        }

        $comboRet .= '</select>';

        return $comboRet;

    }


    public function makeCollectTypeCombo()
    {
       $Envelope = array(
                         'REGULAR_PICKUP' => 'Recoleccion de Fedex',
                         'STATION' => 'Dejar paquete en oficinas'
                        );


        $comboRet = '<select name="DropoffType">';

        foreach($Envelope as $key => $packaging)
        {
            $comboRet.= '<option value="'.$key.'">'.$packaging.'</option>';
        }

        $comboRet .= '</select>';

        return $comboRet;
    }

}
